﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace Enumerable
{

    public class Skill
    {
        //int m_PCID;
        int m_Sec;


        Player _client;


        public Skill(CClinet client, int sec)
        {
            //m_PCID = pcid;
            m_Sec = sec;
            _client = client;
        }

        public IEnumerator GetEnumerator()
        {


            Console.WriteLine("pc start ani({0},{1})", _client.m_ID, m_Sec);

            Console.WriteLine("cur pos ({0},{1})", _client._X, _client._Y);

            yield return new conTimer(m_Sec,
                delegate(double time)
                {
                    _client._X += time * 2;
                    _client._Y += time * 2;
                    Console.WriteLine("complete", _client._X, _client._Y);
                    Console.WriteLine("cur pos ({0},{1})", _client._X, _client._Y);
                },

                delegate(double time)
                {
                    _client._X += time;
                    _client._Y += time;
                    Console.WriteLine("Fail", _client._X, _client._Y);
                    Console.WriteLine("cur pos ({0},{1})", _client._X, _client._Y);
                }
                );

            Console.WriteLine("run  ani");

            if (CheckRange(100, 100, 200, 200))
            {
                // 데미지 처리
            }


            yield break;
        }

        public bool CheckRange(int x, int y, int sx, int sy)
        {

            return true;
        }

    }
}
